//
//  CorgiComposeButton.swift
//  weibo
//
//  Created by Corgi on 17/3/28.
//  Copyright © 2017年 cocoaHangTou. All rights reserved.
//

import UIKit

class CorgiComposeButton: UIButton {

    var composeModel: CorgiComposeModel?
    
    override var isHighlighted: Bool {
    
        set {
        
        }
        
        get {
        
            return false
        }
    }
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        setupUI()
    }
    
    override func layoutSubviews() {
        super.layoutSubviews()
        
        imageView?.frame = CGRect(x: 0, y: 0, width: self.frame.size.width, height: self.frame.size.width)
        
        titleLabel?.frame = CGRect(x: 0, y: self.frame.size.width, width: self.frame.size.width, height: self.frame.size.height - self.frame.size.width)
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }

    private func setupUI() {
        
        //backgroundColor = randomColor()
        
        imageView?.contentMode = .center
        
        titleLabel?.font = UIFont.systemFont(ofSize: FONTSIZEOFNORMAL)
     
        titleLabel?.textAlignment = .center
        
        setTitleColor(.darkGray, for: .normal)
    }
}
